package gmomo.filter;

import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.util.StringUtils;

public class FromResourceFilter implements PacketFilter{

	private ResourceFilter filter;
	
	public FromResourceFilter(ResourceFilter filter) {
		this.filter = filter;
	}
	
	public boolean accept(Packet packet) {
		String resource = StringUtils.parseResource(packet.getFrom());
		return filter.acceptResource(resource);
	}

}
